<%--
  Created by IntelliJ IDEA.
  User: Administrator
  Date: 2021/1/12
  Time: 13:45
  To change this template use File | Settings | File Templates.
--%>
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c" %>
<c:set var="webroot" value="${pageContext.request.contextPath}"/>
<html>
<head>
    <title>${title}</title>
    <script src="${webroot}/element/vue.js"></script>
    <link rel="stylesheet" href="${webroot}/element/index.css">
    <script src="${webroot}/element/index.js"></script>
    <link rel="stylesheet" type="text/css" href="${webroot}/styles/basc.css">
</head>

<body>
<div id="app">
    <%@ include file="../includes/hear.jsp" %>
    <div style="float: left;width: 200px;">
        <%@ include file="../includes/menu.jsp" %>
    </div>
    <div style="float: left;width: 800px;">
        <div class="operation" style="margin-left: 10px;margin-bottom: 10px;padding-top: 10px;">验证信息↓：<span class="mess"
                                                                                        id="Mess">${sessionScope.Mess}</span>
        </div>
        <el-form ref="form" :model="form" style="margin-left: 50px;">
            <el-form-item label="供应商 ">
                <el-input v-model="form.sup_name" style="width: 350px;"></el-input>
            </el-form-item>
            <el-form-item label="商品ID">
                <el-input v-model="form.gid" style="width: 350px;"></el-input>
            </el-form-item>

            <el-form-item label="商品名称">
                <el-input v-model="form.pname" style="width: 350px;"></el-input>
            </el-form-item>

            <el-form-item label="商品单价">
                <el-input v-model="form.price" placeholder="" style="width: 350px;"></el-input>
            </el-form-item>

            <el-form-item label="商品数量">
                <el-input v-model="form.pcount" placeholder="" style="width: 350px;"></el-input>
            </el-form-item>

            <el-form-item label="录入时间">
                <el-input v-model="form.ptime" placeholder="XXXX-XX-XX" style="width: 350px;"></el-input>
            </el-form-item>

            <el-form-item label="类　　别">
                <el-input v-model="form.group" :disabled="true"style="width: 350px;" ></el-input>
            </el-form-item>

            <el-form-item>
                <el-button type="primary" @click="onSubmit">立即提交</el-button>
                <el-button @click="resetForm('form')">重置</el-button>
            </el-form-item>
        </el-form>

    </div>
</div>
</body>
<STYLE>
    #app {
        width: 1280px;
        margin: 0 auto;
    }
</STYLE>
<script>
    new Vue({
        el: '#app',
        data: {
            form: {
                sup_name:'',
                gid: '',
                pname: '',
                price: '',
                pcount: '',
                ptime: '',
                group: '${sessionScope.group}',
            }
        },
        methods: {
            onSubmit() {
                var info = {
                    sup_name:this.form.sup_name,
                    gid: this.form.gid,
                    pname: this.form.pname,
                    price: this.form.price,
                    pcount: this.form.pcount,
                    ptime: this.form.ptime,
                    group: this.form.group,
                }
                window.location.href = '${webroot}/cg_manage/purchase.do?info=' + JSON.stringify(info)+"&action=insert";
            },
            resetForm(form) {
                this.$refs[form].resetFields();
            }
        },
    })
</script>
</html>
